use xiaohao_ar::dichotomy_ar::*;

// 1.
#[test]
fn binary_search_test() {
    let v1 = vec![3, 6, 7, 11];
    assert_eq!(4, binary_search(&v1, 8));
    let v2 = vec![30, 11, 23, 4, 20];
    assert_eq!(30, binary_search(&v2, 5));
    let v3 = vec![30, 11, 23, 4, 20];
    assert_eq!(23, binary_search(&v3, 6));
}

// 2.
#[test]
fn my_sqrt_test() {
    assert_eq!(1, my_sqrt(3));
    assert_eq!(2, my_sqrt(5));
    assert_eq!(3, my_sqrt(12));
    assert_eq!(7, my_sqrt(60));
}